﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddNew.aspx.cs" Inherits="admin_AddNew" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="js/themes/gray/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/themes/icon.css" />
    <script type="text/javascript" src="../js/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
</head>
<body>
    <form id="oForm" method="post">
    <table style="font-size: 13px;">
        <tr>
            <td>
                新闻标题：
            </td>
            <td>
                <input style="width: 400px;" id="newTitle" name="newTitle" class="easyui-validatebox txt"
                    required="true" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                新闻类别：
            </td>
            <td>
                <input id="newType" name="newType" required="true" runat="server" />
                <a class="easyui-linkbutton" plain="true" iconcls="icon-ok" onclick="Btn_Submit()">提交</a>
            </td>
        </tr>
        <tr>
            <td>
                新闻内容：
            </td>
            <td>
                <input name="content" id="content" style="display: none;" runat="server" />
                <iframe src="edit/editor.htm?id=content&ReadCookie=0" frameborder="0" marginheight="0"
                    marginwidth="0" scrolling="No" width="621" height="457"></iframe>
            </td>
        </tr>
    </table>
    <input type="hidden" id="newId" name="newId" runat="server" value="" />
    </form>
</body>
</html>
<script type="text/javascript">
    function Btn_Submit() {
        var url = "";
        if ($("#newId").val() == "") {
            url = "Operation.ashx?cmd=AddNew";
        }
        else {
            url = "Operation.ashx?cmd=UpdateNew";
        }
        $("#oForm").form("submit", {
            url: url,
            onSubmit: function () {
                var check = $(this).form('validate');
                return check;
            },
            success: function (data) {
                var result = eval("(" + data + ")");
                if (result.success) {
                    parent.closeTab();
                } else {
                    $.messager.alert('提示信息', result.msg, 'error');
                }
            }
        });
    }
    $(document).ready(function () {
        $('#newType').combobox({
            url: 'Operation.ashx?cmd=getNewsType',
            panelHeight: "auto",
            valueField: 'val',
            textField: 'txt'
        });
    })
</script>
